﻿@using reCAPTCHA.AspNetCore
@using reCAPTCHA.AspNetCore.Versions;
@using Microsoft.Extensions.Options

@model ContactModel
@inject IOptions<RecaptchaSettings> RecaptchaSettings;

@{
    ViewData["Title"] = "Contact";
}
<!--
    This is an example of using more than 1 form, with recaptcha on the page at once.
-->
<h2>@ViewData["Title"]</h2>
<h3>@ViewData["Message"]</h3>

<address>
    One Microsoft Way<br />
    Redmond, WA 98052-6399<br />
    <abbr title="Phone">P:</abbr>
    425.555.0100
</address>

<address>
    <strong>Support:</strong> <a href="mailto:Support@example.com">Support@example.com</a><br />
    <strong>Marketing:</strong> <a href="mailto:Marketing@example.com">Marketing@example.com</a>
</address>

<div>
    Form 1
    <hr />
</div>
@using (Html.BeginForm("Contact4", "Home", FormMethod.Post))
{
    @Html.ValidationSummary(true)
    <fieldset>
        <div class="form-group">
            @Html.LabelFor(model => model.Message)
            <br />
            @Html.TextAreaFor(model => model.Message, new { @class = "form-control", rows = "3", style = "width: 300px;" })
        </div>
        <div class="form-group">
            @(Html.Recaptcha<RecaptchaV3HiddenInput>(RecaptchaSettings.Value))
        </div>
        <button id="recaptcha" type="submit" class="btn btn-primary">Submit</button>
    </fieldset>
}

<div>
    Form 2
    <hr />
</div>
@using (Html.BeginForm("Contact4", "Home", FormMethod.Post))
{
    @Html.ValidationSummary(true)
    <fieldset>
        <div class="form-group">
            @Html.LabelFor(model => model.Message)
            <br />
            @Html.TextAreaFor(model => model.Message, new { @class = "form-control", rows = "3", style = "width: 300px;" })
        </div>
        <div class="form-group">
            @(Html.Recaptcha<RecaptchaV3HiddenInput>(RecaptchaSettings.Value, new RecaptchaV3HiddenInput
            {
                Id = "recaptcha2"
            }))
        </div>
        <button id="recaptcha2" type="submit" class="btn btn-primary">Submit</button>
    </fieldset>
}